import socket as base_socket
from socket import socket

import socket
HOST='127.0.0.1'
PORT=5000
client=socket.socket(socket.AF_INET,socket.SOCK_STREAM)      #定义socket类型，网络通信，TCP
client.connect((HOST,PORT))       #要连接的IP与端口


while True:
    client_send = input("CLIENT:")
    client.send(client_send.encode())
    data = client.recv(1024)
    print('SERVER:{}'.format(data.decode()))

# client.send('i am client!'.encode())      #把命令发送给对端
# data=client.recv(1024)     #把接收的数据定义为变量
# print('the server response data is :[{}]'.format(data.decode()))
# client.close()   #关闭连接
